import 'dart:async';
import 'dart:ffi';

import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'hc_bot_kit_method_channel.dart';
import 'state.dart';

abstract class HcBotKitPlatform extends PlatformInterface {
  /// Constructs a HcBotKitPlatform.
  HcBotKitPlatform() : super(token: _token);

  static final Object _token = Object();

  static HcBotKitPlatform _instance = MethodChannelHcBotKit();

  /// The default instance of [HcBotKitPlatform] to use.
  ///
  /// Defaults to [MethodChannelHcBotKit].
  static HcBotKitPlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [HcBotKitPlatform] when
  /// they register themselves.
  static set instance(HcBotKitPlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }

  StreamController<GuideState>? controller;

  Future connect(String ipAddress) async {
    await close();
    controller = StreamController();
  }

  Future close() async {
    controller?.close();
  }

  Future<bool> guide(String destination) async => false;

  Future<List<String>> fetchAllPoints();
}
